<?php
class mydb{
    public $host="localhost";
    public $user="root";
    public $password="root";
    public $dbname="userinfo";
    function __construct(){
        $this->con=mysqli_connect($this->host,$this->user,$this->password,$this->dbname);
    }
    function doquery($sql){
        $obj=mysqli_query($this->con,$sql);
        $arr=mysqli_fetch_all($obj);
        return $arr;
    }
    function doadd($sql){
        mysqli_query($this->con,$sql);
    }
    function doupdate($sql){
        $res=mysqli_query($this->con,$sql);
        return $res;
    }
    function dodelete($sql){
        mysqli_query($this->con,$sql);
    }
    function __destruct()
    {
        mysqli_close($this->con);
    }
}
?>